<%@ page import="com.edu.oracle.pojo.Course" %>
<%@ page import="com.edu.oracle.pojo.Teacher" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <meta name="renderer" content="webkit">
        <title></title>
        <link rel="stylesheet" href="css/pintuer.css">
        <link rel="stylesheet" href="css/admin.css">
        <script src="js/jquery.js"></script>
        <script src="js/pintuer.js"></script>
    </head>
    <body>
        <div class="panel admin-panel">
            <div class="panel-head"><strong><span class="icon-key"></span> 修改学生信息</strong></div>
            <div class="body-content">

                <form method="post" class="form-x" action="updateCourse">
                    <div class="form-group">
                        <div class="label">
                            <label for="sitename">课程Id：</label>
                        </div>
                        <div class="field">
                            <label style="line-height:33px;">
                                ${requestScope.course.cno}
                                <input type="hidden" name="cno" value="${requestScope.course.cno}">
                            </label>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="label">
                            <label for="sitename">课程名称：</label>
                        </div>
                        <div class="field">
                            <input type="text" class="input " name="cname" value="${requestScope.course.cname}"
                                   placeholder="姓名"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="label">
                            <label for="sitename">学分：</label>
                        </div>
                        <div class="field">
                            <input type="text" class="input " name="credit" value="${requestScope.course.credit}"
                                   placeholder="姓名"/>
                        </div>
                    </div>

                    <%--      TODO   备忘录：需要完善  教师ID --%>
                    <div class="form-group">
                        <div class="label">
                            <label for="sitename">选择教师：</label>
                        </div>
                        <div class="field">
                            <select name="tno" class="input w50">
                                <option value="${requestScope.course.tno}">
                                    <%
                                        Course course = (Course) request.getAttribute("course");
                                        if(course.getTno()!=null){
                                            for (int i = 0; i <course.getTeacherList().size(); i++) {
                                                Teacher teacher =(Teacher) course.getTeacherList().get(i);
                                                if(  course.getTno().equals(teacher.getTno())){
                                                    out.write(teacher.getTname());
                                                }
                                            }
                                        }

                                    %>
                                </option>

                                <c:forEach items="${requestScope.course.teacherList}" var="teacher1">
                                    <option value="${teacher1.tno}">${teacher1.tname}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="label">
                            <label></label>
                        </div>
                        <div class="field">
                            <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
                        </div>
                    </div>

                </form>

            </div>
        </div>
    </body>
</html>